﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UTSDAL.LINQSQL.Model;

namespace UTSDAL.LINQSQL.DAO
{
    public class CohortModuleDAO:GenericDAO<CohortModule,Guid>
    {
        public List<CohortModule> getCohortModuleForSemester(List<CohortModule> cohortModules, Semester semester)
        {
            if (cohortModules == null)
            {
                cohortModules = base.Context.CohortModules.ToList<CohortModule>();
            }

            var query = from cohortModule in cohortModules
                        where cohortModule.Semester.Equals(semester)
                        select cohortModule;

            return query.ToList<CohortModule>();
        }


        public List<CohortModule> getCohortModulesForSemester(Semester semester)
        {

            return getCohortModuleForSemester(null, semester);
        }
    }
}
